<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
(c) The University of Glasgow 2006
(c) The AQUA Project, Glasgow University, 1993-1998

-}</span><span>
</span><span id="line-6"></span><span>
</span><span id="line-7"></span><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
</span><span id="line-8"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
</span><span id="line-9"></span><span>
</span><span id="line-10"></span><span class="hs-comment">-- | Typechecking annotations</span><span>
</span><span id="line-11"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Tc.Gen.Annotation</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Annotation.html#tcAnnotations"><span class="hs-identifier">tcAnnotations</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Annotation.html#annCtxt"><span class="hs-identifier">annCtxt</span></a></span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-12"></span><span>
</span><span id="line-13"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-14"></span><span>
</span><span id="line-15"></span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Splice.html"><span class="hs-identifier">GHC.Tc.Gen.Splice</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Splice.html#runAnnotation"><span class="hs-identifier">runAnnotation</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-16"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html"><span class="hs-identifier">GHC.Unit.Module</span></a></span><span>
</span><span id="line-17"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-18"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier">when</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Hs.html"><span class="hs-identifier">GHC.Hs</span></a></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Annotations.html"><span class="hs-identifier">GHC.Types.Annotations</span></a></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html"><span class="hs-identifier">GHC.Tc.Utils.Monad</span></a></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html"><span class="hs-identifier">GHC.Driver.Types</span></a></span><span>
</span><span id="line-27"></span><span>
</span><span id="line-28"></span><span class="hs-comment">-- Some platforms don't support the interpreter, and compilation on those</span><span>
</span><span id="line-29"></span><span class="hs-comment">-- platforms shouldn't fail just due to annotations</span><span>
</span><span id="line-30"></span><span class="annot"><a href="GHC.Tc.Gen.Annotation.html#tcAnnotations"><span class="hs-identifier hs-type">tcAnnotations</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Decls.html#LAnnDecl"><span class="hs-identifier hs-type">LAnnDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Annotations.html#Annotation"><span class="hs-identifier hs-type">Annotation</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-31"></span><span id="tcAnnotations"><span class="annot"><span class="annottext">tcAnnotations :: [LAnnDecl GhcRn] -&gt; TcM [Annotation]
</span><a href="GHC.Tc.Gen.Annotation.html#tcAnnotations"><span class="hs-identifier hs-var hs-var">tcAnnotations</span></a></span></span><span> </span><span id="local-6989586621681139845"><span class="annot"><span class="annottext">[LAnnDecl GhcRn]
</span><a href="#local-6989586621681139845"><span class="hs-identifier hs-var">anns</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-32"></span><span>  </span><span id="local-6989586621681139844"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681139844"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv HscEnv
forall gbl lcl. TcRnIf gbl lcl HscEnv
</span><a href="GHC.Tc.Utils.Monad.html#getTopEnv"><span class="hs-identifier hs-var">getTopEnv</span></a></span><span>
</span><span id="line-33"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; Maybe Interp
</span><a href="GHC.Driver.Types.html#hsc_interp"><span class="hs-identifier hs-var hs-var">hsc_interp</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681139844"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-34"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Interp
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(LAnnDecl GhcRn -&gt; IOEnv (Env TcGblEnv TcLclEnv) Annotation)
-&gt; [LAnnDecl GhcRn] -&gt; TcM [Annotation]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">LAnnDecl GhcRn -&gt; IOEnv (Env TcGblEnv TcLclEnv) Annotation
</span><a href="GHC.Tc.Gen.Annotation.html#tcAnnotation"><span class="hs-identifier hs-var">tcAnnotation</span></a></span><span> </span><span class="annot"><span class="annottext">[LAnnDecl GhcRn]
</span><a href="#local-6989586621681139845"><span class="hs-identifier hs-var">anns</span></a></span><span>
</span><span id="line-35"></span><span>    </span><span class="annot"><span class="annottext">Maybe Interp
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[LAnnDecl GhcRn] -&gt; TcM [Annotation]
</span><a href="GHC.Tc.Gen.Annotation.html#warnAnns"><span class="hs-identifier hs-var">warnAnns</span></a></span><span> </span><span class="annot"><span class="annottext">[LAnnDecl GhcRn]
</span><a href="#local-6989586621681139845"><span class="hs-identifier hs-var">anns</span></a></span><span>
</span><span id="line-36"></span><span>
</span><span id="line-37"></span><span class="annot"><a href="GHC.Tc.Gen.Annotation.html#warnAnns"><span class="hs-identifier hs-type">warnAnns</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Decls.html#LAnnDecl"><span class="hs-identifier hs-type">LAnnDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Annotations.html#Annotation"><span class="hs-identifier hs-type">Annotation</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-38"></span><span class="hs-comment">--- No GHCI; emit a warning (not an error) and ignore. cf #4268</span><span>
</span><span id="line-39"></span><span id="warnAnns"><span class="annot"><span class="annottext">warnAnns :: [LAnnDecl GhcRn] -&gt; TcM [Annotation]
</span><a href="GHC.Tc.Gen.Annotation.html#warnAnns"><span class="hs-identifier hs-var hs-var">warnAnns</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Annotation] -&gt; TcM [Annotation]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-40"></span><span class="annot"><a href="GHC.Tc.Gen.Annotation.html#warnAnns"><span class="hs-identifier hs-var">warnAnns</span></a></span><span> </span><span id="local-6989586621681139838"><span class="annot"><span class="annottext">anns :: [LAnnDecl GhcRn]
</span><a href="#local-6989586621681139838"><span class="hs-identifier hs-var">anns</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681139836"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681139836"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="annot"><span class="annottext">AnnDecl GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[LAnnDecl GhcRn]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-41"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; TcRn () -&gt; TcRn ()
forall a. SrcSpan -&gt; TcRn a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#setSrcSpan"><span class="hs-identifier hs-var">setSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681139836"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(TcRn () -&gt; TcRn ()) -&gt; TcRn () -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">WarnReason -&gt; MsgDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#addWarnTc"><span class="hs-identifier hs-var">addWarnTc</span></a></span><span> </span><span class="annot"><span class="annottext">WarnReason
</span><a href="GHC.Driver.Flags.html#NoReason"><span class="hs-identifier hs-var">NoReason</span></a></span><span> </span><span class="annot"><span class="annottext">(MsgDoc -&gt; TcRn ()) -&gt; MsgDoc -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-42"></span><span>             </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Ignoring ANN annotation&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[LAnnDecl GhcRn] -&gt; MsgDoc
forall a. [a] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#plural"><span class="hs-identifier hs-var">plural</span></a></span><span> </span><span class="annot"><span class="annottext">[LAnnDecl GhcRn]
</span><a href="#local-6989586621681139838"><span class="hs-identifier hs-var">anns</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#comma"><span class="hs-identifier hs-var">comma</span></a></span><span>
</span><span id="line-43"></span><span>             </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;because this is a stage-1 compiler without -fexternal-interpreter or doesn't support GHCi&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-44"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">[Annotation] -&gt; TcM [Annotation]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-45"></span><span>
</span><span id="line-46"></span><span class="annot"><a href="GHC.Tc.Gen.Annotation.html#tcAnnotation"><span class="hs-identifier hs-type">tcAnnotation</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Decls.html#LAnnDecl"><span class="hs-identifier hs-type">LAnnDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Annotations.html#Annotation"><span class="hs-identifier hs-type">Annotation</span></a></span><span>
</span><span id="line-47"></span><span id="tcAnnotation"><span class="annot"><span class="annottext">tcAnnotation :: LAnnDecl GhcRn -&gt; IOEnv (Env TcGblEnv TcLclEnv) Annotation
</span><a href="GHC.Tc.Gen.Annotation.html#tcAnnotation"><span class="hs-identifier hs-var hs-var">tcAnnotation</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681139827"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681139827"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621681139826"><span class="annot"><span class="annottext">ann :: AnnDecl GhcRn
</span><a href="#local-6989586621681139826"><span class="hs-identifier hs-var">ann</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#HsAnnotation"><span class="hs-identifier hs-type">HsAnnotation</span></a></span><span> </span><span class="annot"><span class="annottext">XHsAnnotation GhcRn
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">SourceText
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681139824"><span class="annot"><span class="annottext">AnnProvenance (IdP GhcRn)
</span><a href="#local-6989586621681139824"><span class="hs-identifier hs-var">provenance</span></a></span></span><span> </span><span id="local-6989586621681139823"><span class="annot"><span class="annottext">Located (HsExpr GhcRn)
</span><a href="#local-6989586621681139823"><span class="hs-identifier hs-var">expr</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-48"></span><span>    </span><span class="hs-comment">-- Work out what the full target of this annotation was</span><span>
</span><span id="line-49"></span><span>    </span><span id="local-6989586621681139822"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681139822"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) Module
forall (m :: * -&gt; *). HasModule m =&gt; m Module
</span><a href="GHC.Unit.Module.html#getModule"><span class="hs-identifier hs-var">getModule</span></a></span><span>
</span><span id="line-50"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681139820"><span class="annot"><span class="annottext">target :: AnnTarget Name
</span><a href="#local-6989586621681139820"><span class="hs-identifier hs-var hs-var">target</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module -&gt; AnnProvenance Name -&gt; AnnTarget Name
</span><a href="GHC.Tc.Gen.Annotation.html#annProvenanceToTarget"><span class="hs-identifier hs-var">annProvenanceToTarget</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681139822"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">AnnProvenance Name
AnnProvenance (IdP GhcRn)
</span><a href="#local-6989586621681139824"><span class="hs-identifier hs-var">provenance</span></a></span><span>
</span><span id="line-51"></span><span>
</span><span id="line-52"></span><span>    </span><span class="hs-comment">-- Run that annotation and construct the full Annotation data structure</span><span>
</span><span id="line-53"></span><span>    </span><span class="annot"><span class="annottext">SrcSpan
-&gt; IOEnv (Env TcGblEnv TcLclEnv) Annotation
-&gt; IOEnv (Env TcGblEnv TcLclEnv) Annotation
forall a. SrcSpan -&gt; TcRn a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#setSrcSpan"><span class="hs-identifier hs-var">setSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681139827"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) Annotation
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) Annotation)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) Annotation
-&gt; IOEnv (Env TcGblEnv TcLclEnv) Annotation
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
-&gt; IOEnv (Env TcGblEnv TcLclEnv) Annotation
-&gt; IOEnv (Env TcGblEnv TcLclEnv) Annotation
forall a. MsgDoc -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#addErrCtxt"><span class="hs-identifier hs-var">addErrCtxt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">AnnDecl GhcRn -&gt; MsgDoc
forall (p :: Pass).
OutputableBndrId p =&gt;
AnnDecl (GhcPass p) -&gt; MsgDoc
</span><a href="GHC.Tc.Gen.Annotation.html#annCtxt"><span class="hs-identifier hs-var">annCtxt</span></a></span><span> </span><span class="annot"><span class="annottext">AnnDecl GhcRn
</span><a href="#local-6989586621681139826"><span class="hs-identifier hs-var">ann</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) Annotation
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) Annotation)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) Annotation
-&gt; IOEnv (Env TcGblEnv TcLclEnv) Annotation
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-54"></span><span>      </span><span class="hs-comment">-- See #10826 -- Annotations allow one to bypass Safe Haskell.</span><span>
</span><span id="line-55"></span><span>      </span><span id="local-6989586621681139817"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681139817"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-56"></span><span>      </span><span class="annot"><span class="annottext">Bool -&gt; TcRn () -&gt; TcRn ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#safeLanguageOn"><span class="hs-identifier hs-var">safeLanguageOn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681139817"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcRn () -&gt; TcRn ()) -&gt; TcRn () -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; TcRn ()
forall a. MsgDoc -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#failWithTc"><span class="hs-identifier hs-var">failWithTc</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681139813"><span class="hs-identifier hs-var">safeHsErr</span></a></span><span>
</span><span id="line-57"></span><span>      </span><span class="annot"><span class="annottext">AnnTarget Name
-&gt; Located (HsExpr GhcRn)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) Annotation
</span><a href="GHC.Tc.Gen.Splice.html#runAnnotation"><span class="hs-identifier hs-var">runAnnotation</span></a></span><span> </span><span class="annot"><span class="annottext">AnnTarget Name
</span><a href="#local-6989586621681139820"><span class="hs-identifier hs-var">target</span></a></span><span> </span><span class="annot"><span class="annottext">Located (HsExpr GhcRn)
</span><a href="#local-6989586621681139823"><span class="hs-identifier hs-var">expr</span></a></span><span>
</span><span id="line-58"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-59"></span><span>      </span><span id="local-6989586621681139813"><span class="annot"><span class="annottext">safeHsErr :: MsgDoc
</span><a href="#local-6989586621681139813"><span class="hs-identifier hs-var hs-var">safeHsErr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Annotations are not compatible with Safe Haskell.&quot;</span></span><span>
</span><span id="line-60"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;See https://gitlab.haskell.org/ghc/ghc/issues/10826&quot;</span></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-61"></span><span>
</span><span id="line-62"></span><span class="annot"><a href="GHC.Tc.Gen.Annotation.html#annProvenanceToTarget"><span class="hs-identifier hs-type">annProvenanceToTarget</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Decls.html#AnnProvenance"><span class="hs-identifier hs-type">AnnProvenance</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>
</span><span id="line-63"></span><span>                      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Annotations.html#AnnTarget"><span class="hs-identifier hs-type">AnnTarget</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>
</span><span id="line-64"></span><span id="annProvenanceToTarget"><span class="annot"><span class="annottext">annProvenanceToTarget :: Module -&gt; AnnProvenance Name -&gt; AnnTarget Name
</span><a href="GHC.Tc.Gen.Annotation.html#annProvenanceToTarget"><span class="hs-identifier hs-var hs-var">annProvenanceToTarget</span></a></span></span><span> </span><span class="annot"><span class="annottext">Module
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#ValueAnnProvenance"><span class="hs-identifier hs-type">ValueAnnProvenance</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681139810"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681139810"><span class="hs-identifier hs-var">name</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; AnnTarget Name
forall name. name -&gt; AnnTarget name
</span><a href="GHC.Types.Annotations.html#NamedTarget"><span class="hs-identifier hs-var">NamedTarget</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681139810"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-65"></span><span class="annot"><a href="GHC.Tc.Gen.Annotation.html#annProvenanceToTarget"><span class="hs-identifier hs-var">annProvenanceToTarget</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Decls.html#TypeAnnProvenance"><span class="hs-identifier hs-type">TypeAnnProvenance</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681139807"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681139807"><span class="hs-identifier hs-var">name</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; AnnTarget Name
forall name. name -&gt; AnnTarget name
</span><a href="GHC.Types.Annotations.html#NamedTarget"><span class="hs-identifier hs-var">NamedTarget</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681139807"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-66"></span><span class="annot"><a href="GHC.Tc.Gen.Annotation.html#annProvenanceToTarget"><span class="hs-identifier hs-var">annProvenanceToTarget</span></a></span><span> </span><span id="local-6989586621681139806"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681139806"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="annot"><span class="annottext">AnnProvenance Name
</span><a href="GHC.Hs.Decls.html#ModuleAnnProvenance"><span class="hs-identifier hs-var">ModuleAnnProvenance</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module -&gt; AnnTarget Name
forall name. Module -&gt; AnnTarget name
</span><a href="GHC.Types.Annotations.html#ModuleTarget"><span class="hs-identifier hs-var">ModuleTarget</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681139806"><span class="hs-identifier hs-var">mod</span></a></span><span>
</span><span id="line-67"></span><span>
</span><span id="line-68"></span><span id="local-6989586621681139893"><span class="annot"><a href="GHC.Tc.Gen.Annotation.html#annCtxt"><span class="hs-identifier hs-type">annCtxt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Extension.html#OutputableBndrId"><span class="hs-identifier hs-type">OutputableBndrId</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681139893"><span class="hs-identifier hs-type">p</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Decls.html#AnnDecl"><span class="hs-identifier hs-type">AnnDecl</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPass"><span class="hs-identifier hs-type">GhcPass</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681139893"><span class="hs-identifier hs-type">p</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span></span><span>
</span><span id="line-69"></span><span id="annCtxt"><span class="annot"><span class="annottext">annCtxt :: forall (p :: Pass).
OutputableBndrId p =&gt;
AnnDecl (GhcPass p) -&gt; MsgDoc
</span><a href="GHC.Tc.Gen.Annotation.html#annCtxt"><span class="hs-identifier hs-var hs-var">annCtxt</span></a></span></span><span> </span><span id="local-6989586621681139795"><span class="annot"><span class="annottext">AnnDecl (GhcPass p)
</span><a href="#local-6989586621681139795"><span class="hs-identifier hs-var">ann</span></a></span></span><span>
</span><span id="line-70"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; Int -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;In the annotation:&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">AnnDecl (GhcPass p) -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">AnnDecl (GhcPass p)
</span><a href="#local-6989586621681139795"><span class="hs-identifier hs-var">ann</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-71"></span></pre></body></html>